.quick-settings {
  padding: $base_padding * 2 !important;
  border-radius: $material_radius + $base_padding * 2 !important;
  margin-top: $base_padding !important;

  .icon-button, .button {
    padding: $base_padding * 1.75;

    > StIcon {
      icon-size: 16px;
    }
  }
}

.quick-settings-grid {
  spacing-rows: $base_padding * 2;
  spacing-columns: $base_padding * 2;
}

%toggle_button {
  color: $fg_color;
  background-color: $button_bg;
  border-color: $button_border;

  &:hover {
    color: $fg_color;
    background-color: mix($fg_color, $button_bg, 6%);
    border-color: if($variant=='light', darken($button_border, 5%), lighten($button_border, 5%));
  }

  &:active {
    color: $fg_color;
    background-color: mix($fg_color, $button_bg, 12%);
    border-color: if($variant=='light', darken($button_border, 10%), lighten($button_border, 10%));
  }

  &:checked {
    color: $selected_fg_color;
    background-color: $selected_bg_color;
    border-color: if($variant == 'light', $sec_selected_bg_color, $alt_selected_bg_color);
    background-clip: border-box;
  }

  &:checked:hover {
    color: $selected_fg_color;
    background-color: lighten($selected_bg_color, 5%);
    border-color: if($variant == 'light', darken($selected_bg_color, 5%), lighten($selected_bg_color, 10%));
  }

  &:disabled {
    color: $insensitive_fg_color;
    border-color: transparentize($button_border, 0.45);
    background-color: transparentize($button_bg, 0.45);
  }
}

.quick-toggle, .quick-toggle-has-menu {
  border-radius: $material_radius;
  min-width: 12em;
  max-width: 12em;
  min-height: 44px;
  border: 1px solid $borders_color;
  @extend %toggle_button;
}

.quick-toggle {
  & > StBoxLayout { spacing: $base_padding; }

  /* Move padding into the box; this is to allow menu arrows
     to extend to the border */
  &.button { padding: 0; }
  & > StBoxLayout { padding: 0 $base_padding * 2; }
  &:ltr > StBoxLayout { padding-left: $base_padding * 2.5; }
  &:rtl > StBoxLayout { padding-right: $base_padding * 2.5; }

  .quick-toggle-title { font-weight: bold; }

  & StBoxLayout > .quick-toggle-subtitle {
    font-weight: normal;
    font-size: 12px;
  }

  .quick-toggle-icon { icon-size: 16px; }
}

.quick-toggle-has-menu {
  .quick-toggle {
    min-width: auto;
    max-width: auto;
    border: none !important;

    &:ltr { border-radius: $material_radius 0 0 $material_radius; }
    &:ltr > StBoxLayout { padding-right: $base_padding * 1.5; }
    &:rtl { border-radius: 0 $material_radius $material_radius 0; }
    &:rtr > StBoxLayout { padding-left: $base_padding * 1.5; }

    &:ltr:last-child { border-radius: $material_radius; }
    &:rtl:last-child { border-radius: $material_radius; }
  }

  .quick-toggle-menu-button {
    padding: $scaled_padding $scaled_padding * 1.75;
    @extend %toggle_button;
    border: none !important;

    &:ltr {
      border-radius: 0 $material_radius $material_radius 0;
    }

    &:rtl {
      border-radius: $material_radius 0 0 $material_radius;
    }
  }

  & .quick-toggle-separator {
    width: 1px;
    background: $borders_color;
  }
}

.quick-slider {
  & > StBoxLayout { spacing: $base_padding; }

  .slider-bin {
    &:focus { @include button(focus); }
    min-height: 16px; // slider size
    padding: $base_padding;
    border-radius: 16px;
  }

  .quick-toggle-icon {
    icon-size: 16px;
  }

  .icon-button {
    padding: $base_padding;
    background-color: transparent;
    color: $text_color !important;

    &:hover {
      background-color: rgba($fg_color, 0.06);
    }

    &:active {
      background-color: rgba($fg_color, 0.12);
    }
  }
}

.quick-toggle-menu {
  background-color: $menu_bg !important;
  color: $text_color !important;
  border-radius: $material_radius !important;
  padding: $base_padding * 2 0 !important;
  margin: $base_padding * 2 $base_padding * 3 + 1px 0 !important;
  border: if($variant == 'light', 0, 1px) solid $borders_color !important;

  .popup-menu-item {
    border-radius: 0 !important;

    > StIcon {
      -st-icon-style: symbolic;
    }
  }

  & .header {
    spacing-rows: 0.5 * $base_padding;
    spacing-columns: $base_padding * 2;
    padding: 0 $base_padding * 2 $base_padding * 2 !important;

    & .icon {
      icon-size: 16px * 1.5; // a non-standard symbolic size but ok
      border-radius: $circular_radius;
      padding: 1.5 * $base_padding;
      background-color: rgba($fg_color, 0.12) !important;

      &.active {
        background-color: $selected_bg_color !important;
        color: $selected_fg_color;
      }
    }

    & .title {
      @extend %title_3;
    }

    & .subtitle {
      @extend %caption_heading;
    }
  }
}

.quick-settings-system-item {
  & > StBoxLayout { spacing: 2 * $base_padding; }

  .icon-button {
    // background-color: $button_bg;
    // color: $text_color;
    @extend %button;

    > StIcon { -st-icon-style: symbolic; }
  }

  & .power-item {
    min-height: 0;
    min-width: 0;

    &:insensitive {
      @include button(normal);
      background-color: transparent;
    }
  }
}

.nm-network-item {
  .wireless-secure-icon { icon-size: 0.5 * 16px; }
}

.bt-device-item {
  .popup-menu-icon { -st-icon-style: symbolic; }
}

.bt-menu-placeholder.popup-menu-item {
  @extend %title_4;
  text-align: center;

  padding: 2em 4em;
}

.device-subtitle { color: transparentize($fg_color, 0.5); }

.keyboard-brightness-level {
  spacing: $base_padding;

  .button:checked { @extend %default_button; }
}

// background apps

.background-apps-quick-toggle {
  min-height: 40px;
  background-color: transparent;

  & StIcon { icon-size: 16px !important; }
}

.background-app-item {
  & .title { @extend %heading; }
  & .subtitle { @extend %caption; }
  & .popup-menu-icon {
    icon-size: 32px !important;
    -st-icon-style: regular !important;
  }
  & .icon-button {
    padding: $base_padding;
    background-color: transparent;
    border: none !important;

    &:hover {
      background-color: rgba($selected_fg_color, 0.06);
    }

    &:active {
      background-color: rgba($selected_fg_color, 0.12);
    }
  }

  &:hover, &:focus, &.selected {
    .icon-button { color: $selected_fg_color !important; }
  }

  & .spinner {
    padding: $base_padding;
  }
  &.popup-inactive-menu-item { color: $fg_color; }
}
